<?php

class Email extends AppModel {

	var $name = 'Email';
//	var $hasOne = array();
//	var $hasMany = array();
//	var $belongsTo = array();
//	var $hasAndBelongsToMany = array();

//	function beforeSave($data) {}

//	function afterSave() {}

	function sendReminder($jobInfo) {
		extract($jobInfo); //this will give us $Job and $running
		$me = $this->find('offset = ' . $Job['offset']);
		$needles = array(
			'PICKUP OPENCLOSE DATETIME',
			'OPENING DATETIME',
			'CLOSING DATETIME',
			'PICKUP DATE',
			'OPENING DATE',
			'CLOSING DATE'
		);
		$replace = array(
			date('g:i a',strtotime($running['pickup_open'])) . ' through ' . date('g:i a, l, F j', strtotime($running['pickup_closed'])),
			date('g:i a, l, F j', strtotime($running['order_open'])),
			date('g:i a, l, F j', strtotime($running['order_closed']) - 10),
			date('l, F j', strtotime($running['pickup_open'])),
			date('l, F j', strtotime($running['order_open'])),
			date('l, F j', strtotime($running['order_closed']) - 10)
		);
		$me['text'] = r($needles, $replace, $me['Email']['text']);
		return ($me);
	}

}

?>